<?php namespace App\Exceptions;
/**
 * Created by PhpStorm.
 * User: pgzhe
 * Date: 2015/8/6
 * Time: 10:44
 */

use Exception;

/**
 * Class UserInfoEditException      用户信息修改
 * @package App\Exceptions
 */
class UserInfoEditException extends Exception{
    /**
     * 参数定义
     * userIdExists         表示用户user_id不存在
     * Norealname           表示用户名字不存在
     */
    const NouserId = 0x01;
    const Norealname = 0x02;


    public function __construct($code, array $data = [], Exception $previous = null)
    {
        switch ($code) {
            case self::NouserId:
                $message = trans('exception.user_info_edit.nouserId', ['user_id' => array_get($data, 'user_id')]);
                break;
            case self::Norealname:
                $message = trans('exception.user_info_edit.no_realname', ['realname' => array_get($data, 'realname')]);
                break;
            default:
                $message = trans('general.unknown_exception');
                break;
        }

        parent::__construct($message, $code, $previous);
    }
}